//
//  YZNewFriendAPI.m
//  VET
//
//  Created by lixiaoyi on 2018/7/12.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZFriendAPI.h"
#import "YZUser.h"

@implementation YZFriendAPI

/**
 查询好友
 
 @param index 序号
 @param size 大小
 @return 处理结果
 */
+ (RACSignal *)getFriends:(NSUInteger)index
                     size:(NSUInteger)size {
    
    YZFriendAPI *api = [YZFriendAPI api];
    api.action = [NSString stringWithFormat:@"%@index=%ld&size=%ld",kFriendAPI,index,size];
    api.showLoadingStatus = NO;
    
    return [api getRequest];
}


/**
 添加朋友
 
 @param targetId 好友id
 @return 处理结果
 */
+ (RACSignal *)addFriend:(NSString *)targetId {
    
    YZFriendAPI *api = [YZFriendAPI api];
    api.action = [NSString stringWithFormat:@"%@",KAddFriendAPI];
    api.showLoadingStatus = NO;
    
    [api addParam:@"rightId" value:targetId];
    
    return [api postRequest];
}

/**
 删除好友
 
 @param targetId 好友id
 @return 处理结果
 */
+ (RACSignal *)deleFriend:(NSString *)targetId {
    
    YZFriendAPI *api = [YZFriendAPI api];
    api.action = [NSString stringWithFormat:@"%@",kDelFriendAPI];
    api.showLoadingStatus = NO;
    
    [api addParam:@"targetId" value:targetId];
    
    return [api deleteRequest];
    
}


/**
 是否好友
 
 @param targetId 好友id
 @return 处理结果
 */
+ (RACSignal *)isFriend:(NSString *)targetId {
    
    YZFriendAPI *api = [YZFriendAPI api];
    api.action = [NSString stringWithFormat:@"%@%@",kFriendShipAPI,targetId];
    api.showLoadingStatus = NO;
    
    return [api getRequest];
}

/**
 查询用户信息
 
 @param userId 用户的uid
 @return 用户信息
 */
+ (RACSignal *)queryUserInfo:(NSString *)userId {
    YZFriendAPI *api = [YZFriendAPI api];
    api.action = [NSString stringWithFormat:@"%@?userId=%@",kQueryUserAPI,userId];
    api.showLoadingStatus = NO;
    
    return [api getRequest];
}

@end
